package com.mvc.controller;

import java.util.HashMap;

import java.util.Map;

import com.mvc.core.annotation.Controller;
import com.mvc.core.annotation.RequestMapping;
import com.mvc.core.annotation.RequestMethod;
import com.mvc.core.annotation.RequestParam;
import com.mvc.core.util.Request;

@Controller
public class LoginController {
	
	@RequestMapping(value = "/logininput",method = RequestMethod.GET)
	public String loingInput(){
		return "/WEB-INF/views/login.jsp";
	}

	@RequestMapping(value = "/login",method = RequestMethod.GET)
	public String login(@RequestParam LoginParam param){
		System.out.println("用户名:"+param.getUsername()  + "  密码=="+param.getPassword());
		return "/WEB-INF/views/succes.jsp";
	}
	
	public static void main(String[] args) {
		Request request = new Request();
		request.setClassName("com.mvc.controller.LoginController");
		request.setRequestMothod("lonin");
		
		Request request1 = new Request();
		request1.setClassName("com.mvc.controller.LoginController");
		request1.setRequestMothod("lonininput");
		
		Map<String,Request> requestMap = new HashMap<>();
		requestMap.put("/login", request);
		requestMap.put("/lonininput", request1);
		
		Request result = requestMap.get("/lonininput");
		System.out.println(result);
	}
	
}
